<template>
	<view class="container">
		<Header>社情民意</Header>
		<view class="content">
			<view class="title">
				{{data.title}}
			</view>
			<view class="date">
				{{data.createtime_text}}
			</view>
			<view v-html="data.content"></view>
			<view >
				<image :src="url" v-for="(url, index) in data.images" :key="index" mode="aspectFit" style="width: 100%;margin: 5px 0px;"></image>
			</view>
			<view class="status" v-show="data.status_text" style="margin-top: 10px;">
				<label>当前状态：</label>
				<label class="con">{{data.status_text}}</label>
			</view>
			<view class="result" v-for="(item, index) in data.handle" :key="index">
				<view class="result-item time">
					{{item.handle_time}}
				</view>
				<view class="result-item unit">
					<label>办理单位：</label>
					<label class="con">{{item.name}}</label>
				</view>
				<view class="result-item replay">
					<label>答复内容：</label>
					<label class="con">{{item.reply}}</label>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Header from '../../components/header.vue'
	import request from '../../common/request.js'
	export default {
		components: {
			Header
		},
		data() {
			return {
				id: '',
				data:{}
			}
		},
		onLoad(option) {
			this.id  = option.id
		},
		mounted(){
			this.getDetailData()
		},
		methods: {
			getDetailData(){
				request({
					url:'/opinions/detail',
					data:{
						opinions_id: this.id
					},
					method: 'POST'
				}).then(res => {
					if(res.code == 1){
						this.data = res.data
						if(res.data.images && res.data.images != ''){
							if(!Array.isArray(res.data.images)){
								this.data.images = [res.data.images]
							}	
						}
						
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				})
			}
		}
	}
</script>

<style scoped>
	
	.content {
		padding: 20px;
		line-height: 24px;
	}

	.title {
		font-size: 16px;
		font-weight: bold;
		text-align: center;
		line-height: 26px;
	}

	.date {
		font-size: 14px;
		text-align: center;
		margin: 10px 0px;
	}


	.result {
		font-size: 14px;
		margin: 10px 0px;
		border-top: 1px solid #e2e2e2;
	}
	.result-item{
		margin: 5px 0px;
		display: flex;
		line-height: 20px;
	}
	.time{
		color: #909090;
		margin: 10px 0px;
	}
	.result-item label{
		width: 70px;
	}
	.result-item .con{
		display: inline-block;
		width: calc(100% - 70px);
		color: #ea5b6a;
	}
</style>